home *** CD-ROM | disk | FTP | other *** search
- global playerShipSO, armorSO, pBulletSO, eBulletSO, enemySO, enemyData, fleetMovementData, playerData, pBulletData, eBulletData, armorData, playerlevel, totalScore, playerScore, activeBullets, playerintro
-
- on runBugs
- global targetLocationList, deathDelay, frameNumber, frameDelay, totalBugs, accuracyRating, lowestRank, swoopDelay, targetlocation, selectedCraft, homein
- if frameDelay <= 0 then
- frameDelay = 5
- if frameNumber < 3 then
- frameNumber = frameNumber + 1
- else
- frameNumber = 1
- end if
- else
- frameDelay = frameDelay - 1
- end if
- case fleetMovementData[2] of
- #left:
- if fleetMovementData[1][1] < 0 then
- fleetMovementData[2] = #right
- fleetMovementData[1][2] = fleetMovementData[1][2] + 5
- end if
- #right:
- if fleetMovementData[1][1] > 180 then
- fleetMovementData[2] = #left
- fleetMovementData[1][2] = fleetMovementData[1][2] + 5
- end if
- end case
- case fleetMovementData[2] of
- #left:
- fleetMovementData[1][1] = fleetMovementData[1][1] - 2
- #right:
- fleetMovementData[1][1] = fleetMovementData[1][1] + 2
- end case
- validLocs = []
- totalBugs = 0
- lowestRank = 0
- repeat with wBug = 1 to count(enemyData)
- if enemyData[wBug][1] = 1 then
- if findDistance(playerData[2], enemyData[wBug][5]) <= 15 then
- addparticle(playerData[2], 0, 1)
- playSound("Player Death SFX", 3)
- playerData[1] = 0
- end if
- if homein = 1 then
- else
- end if
- if enemyData[wBug][6] <> 0 then
- targetDestination = targetLocationList
- case enemyData[wBug][7] of
- 2:
- targetDestination = targetDestination + point(-50, -15)
- 3:
- targetDestination = targetDestination + point(50, -15)
- end case
- else
- targetDestination = enemyData[wBug][4] + fleetMovementData[1]
- end if
- moveAim = findAngle(enemyData[wBug][5], targetDestination)
- moveDist = findDistance(enemyData[wBug][5], targetDestination)
- if moveDist > 8 then
- moveDist = 8
- end if
- wSprite = wBug + enemySO - 1
- locY = cos(moveAim * PI / 180) * -moveDist
- locX = sin(moveAim * PI / 180) * moveDist
- enemyData[wBug][5] = enemyData[wBug][5] + point(locX, locY)
- repeat with wBullet = 1 to count(pBulletData)
- if pBulletData[wBullet][1] = 1 then
- if findDistance(enemyData[wBug][5], pBulletData[wBullet][2]) <= 20 then
- accuracyRating[1] = accuracyRating[1] + 1
- pBulletData[wBullet][1] = 0
- enemyData[wBug][3] = enemyData[wBug][3] + 1
- set the loc of sprite (pBulletSO + wBullet - 1) to point(-50, -50)
- end if
- end if
- end repeat
- if enemyData[wBug][3] >= 1 then
- playerScore = playerScore + (enemyData[wBug][2] * 15)
- member("Score display").text = string(totalScore + playerScore)
- if enemyData[wBug][6] = 0 then
- else
- end if
- addparticle(enemyData[wBug][5], 0, 1)
- enemyData[wBug][1] = 0
- set the loc of sprite wSprite to point(-50, -50)
- next repeat
- end if
- set the loc of sprite wSprite to enemyData[wBug][5]
- if (enemyData[wBug][4] + fleetMovementData[1])[2] > lowestRank then
- lowestRank = (enemyData[wBug][4] + fleetMovementData[1])[2]
- end if
- set the member of sprite wSprite to "Robot" & ["1", "2", "3", "4"][enemyData[wBug][2]] & ["a", "b", "c", "d"][frameNumber]
- add(validLocs, enemyData[wBug][5])
- totalBugs = totalBugs + 1
- end if
- end repeat
- if (deathDelay = 40) and (playerintro = 0) then
- fleetMovementData[3] = fleetMovementData[3] - 1
- if count(validLocs) > 0 then
- if fleetMovementData[3] < 0 then
- fleetMovementData[3] = [20, 15, 10, 8, 6][playerlevel] + random(10)
- shootLoc = validLocs[random(count(validLocs))]
- addEBullet(shootLoc, 6, random(10) + 175)
- end if
- end if
- else
- end if
- end
-
- on updateArmors
- totalArmors = 4
- repeat with wArmor = 1 to totalArmors
- wSprite = armorSO + wArmor - 1
- rBit = armorData[wArmor][1]
- if rBit = 0 then
- sprite(wSprite).visible = 0
- next repeat
- end if
- set the member of sprite wSprite to "Armor " & string(rBit)
- end repeat
- end
-
- on addBullet spawnloc, spawnSpeed, spawnAim
- validSlot = 0
- repeat with wSlot = 1 to count(pBulletData)
- if (validSlot = 0) and (pBulletData[wSlot][1] = 0) then
- validSlot = wSlot
- end if
- end repeat
- if validSlot <> 0 then
- pBulletData[validSlot] = [1, spawnloc, spawnSpeed, spawnAim]
- playSound("Player Laser SFX", 4)
- end if
- end
-
- on addEBullet spawnloc, spawnSpeed, spawnAim
- validSlot = 0
- repeat with wSlot = 1 to count(eBulletData)
- if (validSlot = 0) and (eBulletData[wSlot][1] = 0) then
- validSlot = wSlot
- end if
- end repeat
- if validSlot <> 0 then
- eBulletData[validSlot] = [1, spawnloc, spawnSpeed, spawnAim]
- playSound("Enemy Laser SFX", 5)
- end if
- end
-
- on runPBullets
- activeBullets = 0
- repeat with wBullet = 1 to count(pBulletData)
- if pBulletData[wBullet][1] = 1 then
- wSprite = pBulletSO + wBullet - 1
- bLoc = pBulletData[wBullet][2]
- validArmor = 0
- repeat with vBlock = 1 to count(armorData)
- if (validArmor = 0) and inside(bLoc, armorData[vBlock][3]) and (armorData[vBlock][1] > 0) then
- validArmor = vBlock
- end if
- end repeat
- if (bLoc[1] < 0) or (bLoc[1] > 580) or (bLoc[2] < 0) or (bLoc[2] > 440) then
- pBulletData[wBullet][1] = 0
- set the loc of sprite wSprite to point(-50, -50)
- next repeat
- end if
- if validArmor <> 0 then
- addparticle(bLoc, 0, 2)
- armorData[validArmor][1] = armorData[validArmor][1] - 1
- pBulletData[wBullet][1] = 0
- set the loc of sprite wSprite to point(-50, -50)
- playSound("Impact Blockers SFX", 6)
- next repeat
- end if
- tASpeed = pBulletData[wBullet][3]
- tAim = pBulletData[wBullet][4]
- locY = cos(tAim * PI / 180) * -tASpeed
- locX = sin(tAim * PI / 180) * tASpeed
- pBulletData[wBullet][2] = pBulletData[wBullet][2] + point(locX, locY)
- set the loc of sprite wSprite to pBulletData[wBullet][2]
- activeBullets = activeBullets + 1
- end if
- end repeat
- end
-
- on runEBullets
- repeat with wBullet = 1 to count(eBulletData)
- if eBulletData[wBullet][1] = 1 then
- wSprite = eBulletSO + wBullet - 1
- bLoc = eBulletData[wBullet][2]
- validArmor = 0
- repeat with vBlock = 1 to count(armorData)
- if (validArmor = 0) and inside(bLoc, armorData[vBlock][3]) and (armorData[vBlock][1] > 0) then
- validArmor = vBlock
- end if
- end repeat
- if (findDistance(playerData[2], eBulletData[wBullet][2]) <= 15) and (playerData[1] = 1) then
- eBulletData[wBullet][1] = 0
- addparticle(playerData[2], 0, 1)
- set the loc of sprite wSprite to point(-50, -50)
- playSound("Player Death SFX", 3)
- playerData[1] = 0
- next repeat
- end if
- if (bLoc[1] < 0) or (bLoc[1] > 580) or (bLoc[2] < 0) or (bLoc[2] > 440) then
- eBulletData[wBullet][1] = 0
- set the loc of sprite wSprite to point(-50, -50)
- next repeat
- end if
- if validArmor <> 0 then
- armorData[validArmor][1] = armorData[validArmor][1] - 1
- eBulletData[wBullet][1] = 0
- set the loc of sprite wSprite to point(-50, -50)
- playSound("Impact Blockers SFX", 6)
- next repeat
- end if
- tASpeed = eBulletData[wBullet][3]
- tAim = eBulletData[wBullet][4]
- locY = cos(tAim * PI / 180) * -tASpeed
- locX = sin(tAim * PI / 180) * tASpeed
- eBulletData[wBullet][2] = eBulletData[wBullet][2] + point(locX, locY)
- set the loc of sprite wSprite to eBulletData[wBullet][2]
- end if
- end repeat
- end
-